package com.smart.campus.school.service.impl;

import java.util.List;
import com.smart.campus.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.smart.campus.school.mapper.AwardsAndPunishmentRecordMapper;
import com.smart.campus.school.domain.AwardsAndPunishmentRecord;
import com.smart.campus.school.service.IAwardsAndPunishmentRecordService;
import com.smart.campus.common.core.text.Convert;

/**
 * 教职工奖惩记录Service业务层处理
 * 
 * @author Zhihe.Li
 * @date 2020-06-01
 */
@Service
public class AwardsAndPunishmentRecordServiceImpl implements IAwardsAndPunishmentRecordService 
{
    @Autowired
    private AwardsAndPunishmentRecordMapper awardsAndPunishmentRecordMapper;

    /**
     * 查询教职工奖惩记录
     * 
     * @param id 教职工奖惩记录ID
     * @return 教职工奖惩记录
     */
    @Override
    public AwardsAndPunishmentRecord selectAwardsAndPunishmentRecordById(Long id)
    {
        return awardsAndPunishmentRecordMapper.selectAwardsAndPunishmentRecordById(id);
    }

    /**
     * 查询教职工奖惩记录列表
     * 
     * @param awardsAndPunishmentRecord 教职工奖惩记录
     * @return 教职工奖惩记录
     */
    @Override
    public List<AwardsAndPunishmentRecord> selectAwardsAndPunishmentRecordList(AwardsAndPunishmentRecord awardsAndPunishmentRecord)
    {
        return awardsAndPunishmentRecordMapper.selectAwardsAndPunishmentRecordList(awardsAndPunishmentRecord);
    }

    /**
     * 新增教职工奖惩记录
     * 
     * @param awardsAndPunishmentRecord 教职工奖惩记录
     * @return 结果
     */
    @Override
    public int insertAwardsAndPunishmentRecord(AwardsAndPunishmentRecord awardsAndPunishmentRecord)
    {
        awardsAndPunishmentRecord.setCreateTime(DateUtils.getNowDate());
        return awardsAndPunishmentRecordMapper.insertAwardsAndPunishmentRecord(awardsAndPunishmentRecord);
    }

    /**
     * 修改教职工奖惩记录
     * 
     * @param awardsAndPunishmentRecord 教职工奖惩记录
     * @return 结果
     */
    @Override
    public int updateAwardsAndPunishmentRecord(AwardsAndPunishmentRecord awardsAndPunishmentRecord)
    {
        awardsAndPunishmentRecord.setUpdateTime(DateUtils.getNowDate());
        return awardsAndPunishmentRecordMapper.updateAwardsAndPunishmentRecord(awardsAndPunishmentRecord);
    }

    /**
     * 删除教职工奖惩记录对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteAwardsAndPunishmentRecordByIds(String ids)
    {
        return awardsAndPunishmentRecordMapper.deleteAwardsAndPunishmentRecordByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除教职工奖惩记录信息
     * 
     * @param userId 教职工奖惩记录ID
     * @return 结果
     */
    @Override
    public int deleteAwardsAndPunishmentRecordById(Long userId)
    {
        return awardsAndPunishmentRecordMapper.deleteAwardsAndPunishmentRecordById(userId);
    }
}
